﻿@using LY.Business.ServiceImpl
@using LY.Entity
@using LY.Entity.Entities
@using LY.Entity.PageSearch
@using LY.Interface

@model PagedList<ProjectEx>
@{
    ViewBag.Title = "List";
    Layout = "~/Views/Shared/_Layout.cshtml";
    IProjectService _projectService = new ProjectService();
    var project_exList = Model;
}
<link href="~/Content/list.css" rel="stylesheet" />
<link href="~/Content/common.css" rel="stylesheet" />
<link href="~/Scripts/laypage/skin/laypage.css" rel="stylesheet" />

<div class="change_banner"></div>
<div class="line10"></div>
<div class="container">
    <div class="wrap mt20">
        <div class="l-header">
            <i class="l-icons lb-icons"></i>
            项 目 列 表  
        </div>
        <div class="l-info">
            <div class="l-menubox">
                <ul class="l-menu">
                    <li class="cur" code="">
                        <i class="b-icons qb-icons" style="background-position: 0 -22px;"></i>
                        <a class="m-text" code="" name="category" href="/DeFault/List">全部</a>
                    </li>
                    @{
                        List<R_ProjectClass> projectClass = ViewBag.ProjectClass;
                        for (int i = 0; i < projectClass.Count; i++)
                        {
                        <li parentid="@projectClass[i].ParentId" code="@projectClass[i].Id">
                            <i class="b-icons  @projectClass[i].Id  showchange" ></i>
                            <a name="category" code="10" href="/DeFault/List?ProjectClassId=@projectClass[i].Id" class="m-text">@projectClass[i].Name</a>
                        </li>  
                        }
                    }
                </ul>
            </div>
            <div class="l-result">
                <div class=" select2 mb20 pr">
                    <div class="s-tits" id="status_p">
                        <span class="s-checked" code=""><i class="s-icons"></i>全部</span>
                        <span class="s-unchecked" code="210"><i class="s-icons"></i>众筹中</span>
                        <span class="s-unchecked" code="220"><i class="s-icons"></i>众筹成功</span>

                    </div>
                    <div class="s-lists">
                        <div class="s-list" id="sort_p">
                            <a href="javascript:;" code="zhtj" id="zhtj" class="cur">综合推荐</a>
                            <a href="javascript:;" code="zxsx" id="zxsx">最新上线</a>
                            <a href="javascript:;" code="jezg" id="jezg">金额最多</a>
                            <a href="javascript:;" code="zczd" id="zczd">支持最多</a>
                            <a href="javascript:;" code="jjjs" id="jjjs">即将结束</a>
                        </div>
                    </div>
                </div>
                <div class="lr-lists">
                    <ul class="infos">
                        <!--这里是循环的开始-->
                        @{
                            foreach (var project_EX in project_exList.DataList)
                            {
                            <div class="query-result-list">
                                <li class="info pr mb20 fl">
                                    <div node-type="qRemind" class="pr">
                                        <a href="/Default/Detail/@project_EX.Id" style="margin-top: 0px;" target="_self" class="link-pic">
                                            <img class="lazyout" src="@project_EX.ProjectThumImage" height="220" width="280" style="display: inline;">
                                        </a>
                                        <div class="q-mask" itemvotype="2" style="height: 0px; overflow: hidden;"></div>
                                    </div>
                                    @if (project_EX.AuditStatus == 210)
                                    {
                                        if (project_EX.ProjectStatus == 8)
                                        {
                                        <i class="smll-icons zc-icons">项目预热</i>
                                        }
                                        else
                                        {
                                        <i class="smll-icons zc-icons">众筹中</i>
                                        }
                                    }
                                    else if (project_EX.AuditStatus == 219)
                                    {
                                        <i class="smll-icons zc-icons">众筹结束</i>
                                    }
                                    else if (project_EX.AuditStatus == 220)
                                    {
                                        <i class="smll-icons zc-icons">众筹成功</i>
                                    }
                                    <a class="support" id="support_@project_EX.Id" onclick="zanclick(@project_EX.Id,2)" style="display: none;">
                                        <i class="support-icons"></i>
                                        @{
                                    var aaa = _projectService.QueryProjectExpand(project_EX.Id);
                                    if (null != aaa)
                                    {
                                            <span>@aaa.zan</span>   
                                    }
                                    else
                                    {
                                            <span>0</span>   
                                    }
                                        }
                                    </a>
                                    <script>
                                        var key = getCookie('Praise_System_Id' + "_" + @project_EX.Id);
                                        if (key == "true") {
                                            $("#support_" + @project_EX.Id).addClass("cur");
                                        }
                                    </script>

                                    <div class="i-tits mb10">
                                        <a href="/Default/Detail/projectId=@project_EX.Id" target="_self">
                                            @if (project_EX.ProjectAdWord.Length > 10)
                                            {
                                                project_EX.ProjectAdWord = project_EX.ProjectAdWord.Substring(0, 10);
                                            }
                                            <h4 class="link-tit mt5">@project_EX.ProjectAdWord</h4>
                                        </a>
                                    </div>
                                    <div class="p-outter">
                                        <div class="p-bar">
                                            <span class="p-b-slide" style="width: @project_EX.ProjectPercent%"></span>
                                        </div>
                                        <div class="p-items">
                                            <ul class="p-i-infos">
                                                <li class="fore1">
                                                    <p class="p-percent">@project_EX.ProjectPercent</p>
                                                    <p class="p-extra">已达</p>
                                                    <span class="v-line"></span>
                                                </li>
                                                <li class="fore2">
                                                    <p class="p-percent">@project_EX.CurrentAmount</p>

                                                    <p class="p-extra">已筹</p>
                                                    <span class="v-line"></span>
                                                </li>
                                                <li class="fore3">
                                                    <p class="p-percent">@project_EX.RemainDays</p>
                                                    <p class="p-extra">剩余时间</p>
                                                </li>
                                            </ul>
                                        </div>
                                    </div>
                                </li>
                            </div>
                            }
                        }
                        <!--这里是循环的结束-->
                    </ul>
                </div>
                <div class="pagesbox" id="gridlist_pagep">
                </div>
            </div>
        </div>
        <div class="l-fav mt100 pb50">
            @Html.Partial("_CainiXihuang", "list")
        </div>
    </div>
</div>
<script src="~/Scripts/laypage/laypage.js"></script>
<script type="text/javascript"> 
    laypage({
        cont: 'gridlist_pagep',
        pages:  @Model.TotalPage, 
        curr: @Model.PageIndex+1,
        jump: function(e, first){ //触发分页后的回调
            if(!first){ //一定要加此判断，否则初始时会无限刷新 
                location.href = changeURLArg(location.search, 'page', e.curr); 
            }
        }
    }); 
    $(function() {
        var args  = GetUrlParms(); 
        $("#status_p span").each(function() {
            if(args["AuditStatus"]!=undefined) 
            {  
                $(this).removeClass("s-checked");
                if ($(this).attr("code") == args["AuditStatus"]) { 
                    $(this).attr("class", "s-checked");
                }   
            }  
            $(this).bind("click", function() {
                location.href = changeURLArg(location.search, 'AuditStatus', $(this).attr("code"));
            }); 
        });
        $("#sort_p a").each(function() {
            if(args["sort"]!=undefined) 
            {  
                $(this).removeClass("cur");
                if ($(this).attr("code") == args["sort"]) { 
                    $(this).attr("class", "cur");
                }   
            } 
            $(this).bind("click", function() {
                location.href = changeURLArg(location.search, 'sort', $(this).attr("code"));
            }); 
        }); 
        $(".l-menu li").each(function() {
            if(args["ProjectClassId"]!=undefined) 
            {  
                $(this).removeClass("cur");
                if ($(this).attr("code") == args["ProjectClassId"]) { 
                    $(this).attr("class", "cur");
                }   
            }  
        }); 
    });
</script>
